#pragma once
#include <iostream>
#include <string>
#include "util.hpp"

namespace NS_log
{
    using namespace NS_util;
    //日志等级
    enum
    {
        INFO,
        DEBUG,
        WARNING,
        ERROR,
        FATAL
    };
    inline std::ostream &Log(const std::string &level,const std::string &file_name,int line)
    {
        //添加日志等级
        std::string message = "[";
        message +=level;
        message +="]";

        //添加报错文件名称

        message += "[";
        message += file_name;
        message += "]";

        //添加报错行

        message += "[";
        message += std::to_string(line);
        message += "]";

        //时间戳
        message += "[";
        message += Timeutil::GetTimestamp();
        message += "]";

        std::cout << message;
        return std::cout;

    }
    //以LOG(.) << "message" << "\n";
    //开方式的日志
    #define LOG(level) Log(#level,__FILE__,__LINE__)
    
    
}